﻿using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using SlamDunk.MES.Domain.Entities.FoundationContext;

namespace SlamDunk.MES.Repository.EntityConfigurations.FoundationContext
{
    /// <summary>
    /// 计量单位实体映射配置
    /// </summary>
    public class MeasureUnitConfig : IEntityTypeConfiguration<MeasureUnit>
    {
        /// <summary>
        /// 配置
        /// </summary>
        public void Configure(EntityTypeBuilder<MeasureUnit> builder)
        {
            //配置属性
            builder.HasKey(unit => unit.Id).IsClustered(false);
            builder.Property(unit => unit.MasterCoefficient).HasPrecision(29, 10);

            //配置索引
            builder.HasIndex(unit => unit.AddedTime).IsUnique(false).IsClustered();
        }
    }
}
